<?php

use hhz\constant\redis\redisKeys;
use Hhz\Redis\newCache;

class SubscribeAction extends ActionPlugin
{
    public const USER_LEVEL = self::LEVEL_REGISTER;


    public function main()
    {
        if ($this->uid) {
            $redis = new newCache(redisKeys::KEY_B_CACHE_SUPER_SUBSIDY_DAY_SUBSCRIBE);
            $subKeyPrefix = 'subscribe_seckill-' . $this->uid . '-' . date('Ymd', strtotime(date('Y-m-d')) + 86400);
            $data = ['subscribe' => 1];
            $redis->setCache($data, $subKeyPrefix);
            $redis->setExpireTime(86400 * 2, $subKeyPrefix);
        }
        $this->setSuccess([]);
    }
}